<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>form集合</title>
</head>
<body>
    <form action="/login.do" method="post">
        <table border="1px">
            <caption>第一个表单</caption>
            <tr>
                <td>用户名</td>
                <td><input type="text" name="name" maxlength="16"></td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input type="password" name="password" maxlength="16"></td>
            </tr>
            <tr>
                <td colspan="2" align="right">
                    <input type="submit">
                </td>
            </tr>
        </table>
    </form>
    <hr/>
    <form action="#" method="post">
            <table border="1px">
                <caption>第二个表单</caption>
                <tr>
                    <td>第二个用户名</td>
                    <td><input type="text" name="name" maxlength="16"></td>
                </tr>
                <tr>
                    <td>第二个密码</td>
                    <td><input type="password" name="password" maxlength="16"></td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        <input type="submit">
                    </td>
                </tr>
            </table>
        </form>
</body>
</html>
<script>
    var frms = document.forms;
    for (var i = 0; i < frms.length; i++) {
        console.log(frms[1].innerHTML);
    }

    var form1 = document.forms[0];
    console.log(form1.innerHTML);

    var eles = form1.elements;
    for (var i = 0; i < eles.length; i++) {
        console.log(eles[i].tagName + ","+ eles[i].getAttribute("type"))
    }
    console.log(form1.action);
</script>